home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v10n18.arc / LN1018.ARC / TOOLBOOK.1 < prev   
Text File  |  1991-10-30  |  906b  |  27 lines

  1. Sub MAIN
  2.    ChDir "c:\toolbook"
  3.    Shell "tbook.exe", 0
  4.    tbk = DDEInitiate("ToolBook", "System")
  5.    ' ToolBook ignores startup minimize request
  6.    SendKeys "% n", 1
  7.    DDEExecute tbk, "draw a field from 0,0 to 1,1"
  8.    On Error Goto done     ' when user hits Cancel
  9.    expr$ = ""
  10.    While 1
  11.       expr$ = InputBox$("OpenScript expression", \
  12.          "ToolBookDDE", expr$)
  13.       If Left$(expr$, 2) = "! " Then
  14.          ' use ! for statements such as "set blah to blah"
  15.          DDEExecute tbk, Right$(expr$, Len(expr$) - 2)
  16.       Else
  17.          DDEExecute tbk, "put " + expr$ + " into text of selection"
  18.          retval$ = DDERequest$(tbk, "text of selection")
  19.          MsgBox(expr$ + " = " + retval$, "Open Script return value")
  20.       End If
  21.    Wend
  22. done:
  23.    DDETerminate tbk
  24.    AppActivate "Introducing ToolBook", 1    ' so we can close it 
  25.    SendKeys "%{f4}" ' Close
  26. End Sub
  27.